import { api } from './request'

/**
 * 系统设置相关API接口
 */
export const settingsApi = {
  /**
   * 获取系统设置
   */
  getSettings: () => {
    return api.get('/settings/get')
  },

  /**
   * 更新系统设置
   * @param data 系统设置数据
   */
  updateSettings: (data: {
    siteName?: string
    siteLogo?: string
    siteFavicon?: string
    siteDescription?: string
    siteKeywords?: string
    siteCopyright?: string
    icpNumber?: string
    policeNumber?: string
    smtpHost?: string
    smtpPort?: number
    smtpUsername?: string
    smtpPassword?: string
    smtpFrom?: string
    uploadType?: string
    uploadPath?: string
    uploadUrl?: string
    uploadMaxSize?: number
    uploadAllowTypes?: string
    theme?: string
    language?: string
    encryption?: string
  }) => {
    return api.put('/settings/update', data)
  },

  /**
   * 测试邮件发送
   * @param email 收件人邮箱
   */
  testEmail: (email: string) => {
    return api.post('/settings/test-email', { email })
  }
}